package com.mayqlzu.scrollviewevent;

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.widget.ListView;
import android.widget.ScrollView;

/**
 * Created by wangbh on 2017/10/18.
 */

public class MyScrollView extends ScrollView {
    private final static String TAG="MyListViews";
    public MyScrollView(Context context) {
        super(context);
        Log.d(TAG, "MyScrollView: 初始化1");
    }

    public MyScrollView(Context context, AttributeSet attrs) {
        super(context, attrs);

        Log.d(TAG, "MyScrollView: 初始化2");
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        boolean b = super.dispatchTouchEvent(ev);
       // Log.d(TAG, "dispatchTouchEvent: "+b);
        return b;
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        switch (ev.getAction()){
            case MotionEvent.ACTION_DOWN:
                Log.d(TAG, "ScrollView ACTION_DOWN: ");
                break;
            case MotionEvent.ACTION_MOVE:
                Log.d(TAG, "ScrollView ACTION_MOVE: ");
                break;
            case MotionEvent.ACTION_UP:
                Log.d(TAG, "ScrollView ACTION_UP: ");
                break;
            case MotionEvent.ACTION_CANCEL:
                Log.d(TAG, "ScrollView ACTION_CANCEL: ");
                break;
        }
        boolean b = super.onInterceptTouchEvent(ev);
        Log.d(TAG, "ScrollView onInterceptTouchEvent: "+b);
        return b;
    }

    @Override
    public boolean onTouchEvent(MotionEvent ev) {
        boolean b = super.onTouchEvent(ev);
       // Log.d(TAG, "ScrollView onTouchEvent: "+b);
        return b;
    }
}
